package org.lds.hotkey.client.autoconfigure.hotkey.report;

import lombok.extern.slf4j.Slf4j;
import org.lds.hotkey.common.model.ReportRuleModel;
import org.lds.hotkey.common.util.ThreadPoolUtil;

import java.util.Map;
import java.util.concurrent.ExecutorService;

@Slf4j
public class WorkerService {
    private ExecutorService executorService = ThreadPoolUtil.newExecutor("WorkerService", 20);
    public void asyncPush(Map<String, ReportRuleModel> workerReportRuleModelMap) {
        workerReportRuleModelMap.forEach((address, reportRuleModel) -> {
            executorService.submit(new WorkerTask(address, reportRuleModel));
        });
    }
}
